home *** CD-ROM | disk | FTP | other *** search
/ Inside Multimedia 1994 April / Inside Multimedia CD-ROM (April 1994).iso / prg / gs / gs250.exe / MAKE.DOC < prev    next >
Encoding:
Text File  |  1992-09-03  |  21.8 KB  |  530 lines

  1.    Copyright (C) 1989, 1990, 1991 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.
  19.  
  20. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  21.  
  22. This file, make.doc, describes how to install Ghostscript, and how to
  23. build Ghostscript executables from source.
  24.  
  25. For an overview of Ghostscript and a list of the documentation files, see
  26. README.
  27.  
  28. ********
  29. ******** Installing Ghostscript
  30. ********
  31.  
  32. To install the interpreter, you need:
  33.     - The interpreter executable:
  34.         - On MS-DOS and VMS systems, gs.exe.
  35.         - On MS-DOS systems, if you are using the Watcom compiler,
  36.           the DOS extender, dos4gw.exe.
  37.         - On Unix systems, gs.
  38.     - The interpreter initialization files:    gs_*.ps and sym__enc.ps.
  39.     - The font map: Fontmap.
  40.     - The default font: uglyr.gsf.
  41.  
  42. See use.doc for a description of the search algorithm used to find these
  43. files.
  44.  
  45. You do not need any of these files when using the library; however, the
  46. library currently provides no way to install fonts.  This is obviously
  47. ridiculous and will be fixed sometime in the future.
  48.  
  49. ********
  50. ******** Building Ghostscript from source
  51. ********
  52.  
  53. Ghostscript is generally distributed in the form of a compressed tar file.
  54. When unpacked, this file puts all the Ghostscript files in a directory
  55. called gs.  Ghostscript is also available in the form of PC-compatible ZIP
  56. files.
  57.  
  58. Ghostscript is described by a collection of several makefiles:
  59.  
  60.     gs.mak - a generic makefile used on all platforms (except VMS).
  61.     devs.mak - a makefile listing all the device drivers.
  62.     *.mak - the makefiles for specific platforms.
  63.  
  64. You may need to edit the platform-specific makefile if you wish to change
  65. any of the following options:
  66.  
  67.     - The default search path(s) for the initialization and font files
  68. (macro GS_LIB_DEFAULT);
  69.  
  70.     - The debugging options (macro TDEBUG);
  71.  
  72.     - The set of device drivers to be included (DEVICE_DEVS
  73.     and DEVICE_DEVS2..5 macros);
  74.  
  75.     - The set of optional features to be included (FEATURE_DEVS macro).
  76.  
  77. The platform-specific makefile will include comments describing all of
  78. these items except the DEVICE_DEVS options.  The DEVICE_DEVS options are
  79. described in devs.mak, even though the file that must be edited is the
  80. platform-specific makefile.
  81.  
  82. The makefiles distributed with Ghostscript define these options as
  83. follows:
  84.  
  85.     - GS_LIB_DEFAULT: on Unix systems, the current directory at build
  86. time; on MS-DOS systems, C:\GS.
  87.  
  88.     - TDEBUG: no debugging code included in the build.
  89.  
  90.     - DEVICE_DEVS: platform-specific, see below.
  91.  
  92.     - FEATURE_DEVS: platform-specific.
  93.  
  94. There are also platform-specific options described below under the
  95. individual platforms.  See the "Options" section near the beginning of the
  96. relevant makefile for more information.
  97.  
  98. If you are including a dot-matrix printer driver, you may wish to
  99. customize the default resolution parameters in devs.mak.
  100.  
  101. To build the interpreter, you need all the .h and .c files (and .asm files
  102. for MS-DOS) included in the distribution, as well as the makefiles.
  103.  
  104. The command
  105.     make clean
  106. removes all the files created by the build process (relocatables,
  107. executables, and miscellaneous scratch files).  If you want to save the
  108. executable, you should move it to another directory first.
  109.  
  110. ********
  111. ******** How to build Ghostscript from source (MS-DOS version) ********
  112. ********
  113.  
  114. The makefiles distributed with Ghostscript select the following
  115. devices for inclusion in the executable:
  116.  
  117.     Turbo C:
  118.         VGA and EGA displays
  119.         Epson-compatible dot matrix printers
  120.           (default resolution 180 x 180 DPI)
  121.         Canon BJ-10e (BubbleJet) printer
  122.           (default resolution 360 x 360 DPI)
  123.     Borland C++: all of the above, plus:
  124.         H-P DeskJet and LaserJet family printers
  125.           (default resolution 300 DPI)
  126.         GIF file format
  127.     Watcom C/386: all of the above, plus:
  128.         (partial) Display PostScript and PostScript Level 2 features
  129.         Tseng ET3000/ET4000 SuperVGA displays
  130.         H-P PaintJet printer
  131.         PBM/PGM/PPM file formats
  132.         PCX file format
  133.  
  134. These options were chosen to strike a balance between RAM consumption and
  135. likely usefulness.  (Turbo C is limited to 640K and does not support code
  136. overlaying; Borland C++ is limited to 640K, but supports code overlaying;
  137. Watcom C/386 is not limited to 640K.)
  138.  
  139. To build Ghostscript, you need MS-DOS version 3.3 or later, and a Borland
  140. C/C++ development system or the Watcom C/386 development system.  Details
  141. are given below.
  142.  
  143. As noted above, the default configuration generates an executable that
  144. assumes the directory where 'make' was run should be the final default
  145. directory for looking up the Ghostscript initialization and font files.
  146.  
  147. To build the Ghostscript executable, all you need to do is give the
  148. command
  149.     make
  150. You must have COMMAND.COM in your path to build Ghostscript.
  151.  
  152. There is a special 'make' target that simply attempts to compile all the
  153. .c files in the current directory.  Some of these compilations will fail,
  154. but the ones that succeed will go considerably faster, because they don't
  155. individually pay the overhead of loading the compiler into memory.  So a
  156. good strategy for building the executable for the first time, or after a
  157. change to a very widely used .h file, is:
  158.     make begin
  159. and then
  160.     make
  161. to do the compilations that failed the first time.
  162.  
  163. Note: if you get the Ghostscript sources from a Unix 'tar' file and unpack
  164. the file on a MS-DOS machine, the files will all have linefeed instead of
  165. carriage return + linefeed as the line terminator, which will make the C
  166. compiler unhappy.  I don't know the simplest way to fix this: just reading
  167. each file into an editor and writing it back out again may be sufficient.
  168.  
  169. Borland environment
  170. -------------------
  171.  
  172. To compile Ghostscript with the Borland environment, you need either Turbo
  173. C (version 2.0 or later) or Turbo C++ or Borland C++ (version 1.0 or
  174. later); specifically, the compiler, 'make' utility, and linker.  You also
  175. need either the Borland assembler (version 1.0 or later) or the Microsoft
  176. assembler (version 4.0 or later).  Before compiling or linking, you should
  177. execute
  178.     echo !include "turboc.mak" >makefile
  179. (for Turbo C and MS-DOS), or
  180.     echo !include "tbcplus.mak" >makefile
  181. (for Turbo C++ or Borland C++ and MS-DOS), or
  182.     echo !include "bcwin.mak" >makefile
  183. (for Turbo C++ or Borland C++ and Microsoft Windows), or
  184.  
  185. Besides the source files and the makefiles, you need:
  186.     turboc.cfg (the flags and switches for Turbo C)
  187.     gs.tr (the linker commands for the interpreter)
  188.     *.bat (a variety of batch files used in the build process)
  189.  
  190. There are extensive comments in the aforementioned .mak files
  191. regarding various configuration parameters.  If your configuration is
  192. different from the following, you should definitely read those
  193. comments and see if you want or need to change any of the parameters:
  194.     - The compiler files are in c:\tc (for Turbo C) or c:\bc (for
  195. Turbo C++ or Borland C++) and its subdirectories.
  196.     - You are using the Borland assembler (tasm).
  197.     - You want an executable that will run on any PC-compatible,
  198. regardless of processor type (8088, 8086, V20, 80186, 80286, V30, 80386,
  199. 80486) and regardless of whether a math coprocessor (80x87) is present.
  200.  
  201. NOTE: Borland C++ 3.0 has two problems that affect Ghostscript:
  202.  
  203.     - The assembler, tasm, often crashes when attempting to
  204. assemble gdevegaa.asm.  If this happens, try again, or use another
  205. assembler (e.g., an older version of tasm) if you have one, or set
  206. USE_ASM=0 in the makefile.
  207.  
  208.     - The math library for Microsoft Windows, mathwl.lib, has a
  209. bug that causes floating point numbers to print incorrectly.  Contact
  210. Borland for a corrected version.
  211.  
  212. Watcom environment
  213. ------------------
  214.  
  215. To avoid annoying messages from the DOS extender, add the line
  216.     set DOS4G=quiet
  217. to your autoexec.bat file. 
  218.  
  219. To compile Ghostscript with the Watcom C/386 compiler, you need to create
  220. a makefile by executing
  221.  
  222.     echo !include watc.mak >makefile
  223.  
  224. To build Ghostscript, execute
  225.  
  226.     wmake -u
  227.  
  228. ********
  229. ******** How to build Ghostscript from source (Unix version) ********
  230. ********
  231.  
  232. The makefile distributed with Ghostscript selects the following devices
  233. for inclusion in the build:
  234.     X Windows driver only.
  235.  
  236. Before compiling or linking, you should execute
  237.  
  238.     ln -s unix-cc.mak makefile
  239. or    ln -s unix-gcc.mak makefile
  240. or    ln -s unix-ansi.mak makefile
  241.  
  242. depending on whether your C compiler is a standard Kernighan & Ritchie C
  243. compiler, gcc being used in ANSI mode, or an ANSI C compiler other than
  244. gcc respectively.  (If you want to use gcc in non-ANSI mode, use
  245. unix-cc.mak and define the CC macro to refer to gcc.)
  246.  
  247. If the X11 client header files are located in some directory which your
  248. compiler does not automatically search, you must change the XINCLUDE macro
  249. the makefile to include a specific -I switch.  See the comment preceding
  250. XINCLUDE in the makefile.
  251.  
  252. The only important customization of the X11 driver is the choice of
  253. whether or not to use a backing pixmap.  If you use a backing pixmap,
  254. Ghostscript windows will redisplay properly when they are covered and
  255. exposed, but drawing operations will go slower.  This choice is controlled
  256. by a line in the file gdevx.c that says
  257.     private int use_backing = 1;
  258. Changing this line to read
  259.     private int use_backing = 0;
  260. will disable the use of a backing pixmap.  However, portions of the
  261. Ghostscript window may not be properly redrawn after the window is
  262. restored from an icon or exposed after being occluded by another window.
  263.  
  264. Some versions of the X server do not implement tiling properly.  This will
  265. show up as broad bands of color where dither patterns should appear.  If
  266. this happens, change
  267.     private int use_XSetTile = 1;
  268. to
  269.     private int use_XSetTile = 0;
  270. and recompile.  The result will run a lot slower, but the output should be
  271. correct.  If this fixes the problem, report it to whoever made your X
  272. server.
  273.  
  274. Similarly, some versions of the X server do not implement bitmap/pixmap
  275. displaying properly.  This may show up as white or black rectangles where
  276. characters should appear, or characters may appear in "inverse video"
  277. (e.g., white on a black rectangle).  If this happens, it may help you to
  278. change
  279.     private int use_XPutImage = 1;
  280. to
  281.     private int use_XPutImage = 0;
  282. and recompile.  Again, there will be a serious performance penalty; again,
  283. if this fixes the problem, notify the supplier of your X server.
  284.  
  285. Currently Ghostscript is set up to compile and link in a generic Unix
  286. environment.  Some Unix environments may require changing the LDFLAGS
  287. macro in the makefile.
  288.  
  289. All you need to do to make an executable is invoke the shell command
  290.     make
  291.  
  292. Ghostscript uses ANSI syntax for function definitions. Because of this,
  293. when compiling with cc, it must preprocess each .c file to convert it to
  294. the older syntax defined in Kernighan and Ritchie, which is what most
  295. current Unix compilers (other than gcc) support.  This step is
  296. automatically performed by a utility called ansi2knr, which is included in
  297. the Ghostscript distribution.  The makefile automatically builds ansi2knr.
  298.  
  299. The ansi2knr preprocessing step is included in the makefile rule for
  300. compiling .c files.  ansi2knr creates a file called _temp_.c to hold the
  301. converted code.  If you want to change this name for some reason, it is
  302. defined in unix-cc.mak.
  303.  
  304. Note that the abovementioned makefiles are actually generated mechanically
  305. from *head.mak, *tail.mak, gs.mak, and devs.mak.  If you want to change
  306. the makefile, edit the appropriate one of these files, and then invoke the
  307.     tar_cat
  308. shell script to reconstruct the unix-*.mak makefile.
  309.  
  310. Platform-specific notes
  311. -----------------------
  312.  
  313. 386 Unix:
  314.     Due to a compiler bug, if you are building Ghostscript on an Intel
  315. 80386 system using a version of gcc older than version 1.38, you must not
  316. use the -O option.
  317.     X11R5 may need #include <stddef.h> in x_.h.  If you are using
  318. a stock System V platform that lacks rename and gettimeofday, change
  319. PLATFORM=unix_ in the makefile to PLATFORM=sysv_.
  320.  
  321. Apollo:
  322.     You must run the compiler in ANSI-compatible mode (i.e., set AK=
  323. <null string> in the makefile); otherwise, it gives incorrect error
  324. messages for any function declared as returning a float value.
  325.  
  326. Convex:
  327.     Use unix-ansi.mak.  Do not invoke optimization (-O1): there
  328. are compiler bugs that lead to incorrect code.  Set CFLAGS to
  329.     -fn -tm -no c1
  330.  
  331. DEC (Ultrix):
  332.     Many versions of DEC's X server (DECwindows) have bugs that
  333. require setting use_XPutImage or use_XSetTile to 0, as described above.
  334.  
  335. H-P 700 series:
  336.     You may need to use +O1 rather than -O to get the compiler to
  337. produce correct code.
  338.  
  339. ISC Unix:
  340.     For ISC Unix with gcc, an appropriate make invocation is:
  341.     make XCFLAGS="-D__SVR3 -posix" LDFLAGS="-shlib -posix" \
  342.          EXTRALIBS="-linet -lnsl_s"
  343. If this doesn't work for you, try removing the -shlib.  ISC Unix may
  344. also need one or more of the following in EXTRALIBS: -lpt, -lc_s.
  345. See also under "386 Unix" above.
  346.  
  347. MIPS:
  348.     There is apparently a bug in the MIPS C compiler which causes
  349. gxdither.c to compile incorrectly if optimization is enabled (-O).  Until
  350. a work-around is found, do not use -O with the MIPS C compiler.
  351.  
  352. Any platform with GNU make:
  353.     GNU make 3.59 can't handle the final linking step in some cases;
  354. use the platform's standard make (e.g., /bin/make) if this happens.
  355.  
  356. RS/6000:
  357.     IBM RS/6000, you must define _POSIX_SOURCE and you must use the
  358. c89 compiler, not cc, e.g.:
  359.  
  360.     make -f unix-ansi.mak CC=c89 XCFLAGS=-D_POSIX_SOURCE \
  361.     XINCLUDE=-I/usr/misc/X11/include XLIBDIRS=-L/usr/misc/X11/lib
  362.  
  363. Apparently some (but not all) releases of the C library declare the hypot
  364. function: if the declaration in math_.h produces an error message, try
  365. removing it.  Also, the IBM X11R3 server is known to be buggy: use the MIT
  366. X server if possible.  Even beyond all this, many people have trouble with
  367. Ghostscript on the RS/6000.  The usual symptom is that it compiles and
  368. links OK, but produces garbaged output on the screen.  The problem may be
  369. related to particular versions of AIX or the X server; we don't have
  370. enough information at this time.  The following combinations of AIX and X
  371. are known to fail:
  372.     AIX 3.1.5, MIT X11R4, c89
  373. The following combinations are known to work:
  374.     AIX 3.1.5, MIT X11R5, c89
  375.     AIX 3.2, MIT X11R5, xlc 1.2.0.9
  376.  
  377. SCO Unix:
  378.     The SCO Unix C compiler apparently can't handle the Pn macros
  379. in std.h.  If you get strange compilation errors on SCO Unix, see if
  380. you can get a compiler fix from SCO.  Meanwhile, to use gcc with SCO
  381. ODT, see gcc-head.mak for the appropriate switch settings.  See also
  382. under "386 Unix" above.
  383.  
  384. Sun:
  385.     The Sun unbundled C compiler (SC1.0) doesn't compile Ghostscript
  386. properly if the -fast option is selected: Ghostscript core-dumps in
  387. build_gs_font.  Use -g, or use gcc.
  388.     The standard Sun cc may not compile iscan.c correctly if
  389. optimization (-O) is selected.  One symptom is that numbers such as 1.e-3
  390. give a syntax error.  This has been observed on a SPARCstation running
  391. SunOS 4.1.1.  If this happens, use -g for this file, or use gcc.
  392.  
  393. ********
  394. ******** How to build Ghostscript from source (VAX/VMS version) ********
  395. ********
  396.  
  397. The files VMS-CC.MAK and VMS-GCC.MAK are VMS DCL command files which
  398. build Ghostscript from scratch using either the DEC C compiler, CC, or
  399. the Free Software Foundation's GNU C compiler, GCC.  Accordingly, you
  400. must have one of these two compilers installed in order to build
  401. Ghostscript.  (Other C compilers may work: CC and GCC are the only two
  402. compilers tested to date.)  These two command files build and store
  403. the Ghostscript library in the object library GS.OLB.  If you have
  404. DECwindows (X11) installed on your system, the executable images GS.EXE,
  405. GT.EXE, and XLIB.EXE will also be built.
  406.  
  407. In some environments (perhaps only Motif, as opposed to DECWindows,
  408. environments), it may be necessary to add
  409. SYS$SHARE:DECW$XLIBSHR/SHARE or SYS$SHARE:DECW$XTSHR.EXE/SHARE to the
  410. list of link libraries, in addition to DWTLIBSHR.  Only two users
  411. have reported this problem, and we don't know under what
  412. circumstances it occurs.
  413.  
  414. The only important customization of the X11 driver is the choice of
  415. whether or not to use a backing pixmap.  If you use a backing pixmap,
  416. Ghostscript windows will redisplay properly when they are covered and
  417. exposed, but drawing operations will go slower.  This choice is controlled
  418. by the line in the file gdevx.c that reads
  419.     private int use_backing = 1;
  420. Changing this line to read
  421.     private int use_backing = 0;
  422. will disable the use of a backing pixmap.  However, portions of the
  423. Ghostscript window may not be properly redrawn after the window is
  424. restored from an icon or exposed after being occluded by another window.
  425.  
  426. Many versions of DEC's X server (DECwindows) have bugs that require
  427. setting use_XPutImage or use_XSetTile to 0, as described above.  These
  428. show up as broad bands of color where dither patterns should appear, or
  429. characters displayed white on top of black rectangles or not displayed at
  430. all.  If this happens, change use_XSetTile or use_XPutImage to 0 as
  431. described above.  The result will run a lot slower, but the output will be
  432. correct.  Report the problem to DEC, or whoever supplied your X server.
  433.  
  434. Ghostscript uses ANSI syntax for function definitions. Thus, when using
  435. the DEC C compiler, each .C file is converted to the older C syntax defined
  436. in the first edition of Kernighan and Ritchie and stored in a .CC file.
  437. This step is performed by VMS-CC.MAK using the ansi2knr utility included
  438. in the Ghostscript distribution.  If you are building a debuggable
  439. configuration, the .CC files will be left behind by VMS-CC.MAK for use by
  440. the VMS Debugger; otherwise, they will be deleted.
  441.  
  442. If you have DEC's C compiler, issue the DCL command
  443.         $ @VMS-CC.MAK
  444. to build Ghostscript.  If you have GNU C, issue the DCL command
  445.         $ @VMS-GCC.MAK
  446. to build Ghostscript.
  447.  
  448. The option "DEBUG" may be specified with either command file in order to
  449. build a debuggable Ghostscript configuration:
  450.         $ @VMS-CC.MAK DEBUG    -or-   $ @VMS-GCC.MAK DEBUG
  451.  
  452. In order to specify switches and file names when invoking the interpreter,
  453. define GS as a foreign command:
  454.         $ GS == "$disk:[directory]GS.EXE"
  455. where "disk" and "directory" specify the disk and directory where Ghostscript
  456. is located.  For instance,
  457.         $ GS == "$DUA1:[GHOSTSCRIPT]GS.EXE"
  458. To allow the interpreter to be run from any directory, define the logical
  459. GS_LIB which points to the Ghostscript directory
  460.         $ DEFINE GS_LIB disk:[directory]
  461. This allows Ghostscript to locate its initialization files stored in the
  462. Ghostscript directory -- see use.doc for further details.  Finally, to
  463. invoke the interpreter, merely type GS.  Although DCL normally converts
  464. unquoted parameters to upper case, C programs receive their parameters in
  465. lower case.  That is, the command
  466.         $ GS -Isys$login:
  467. passes the switch "-isys$login" to the interpreter.  To preserve the
  468. case of switches, enclose them in double quotes; e.g.,
  469.         $ GS "-Isys$login:"
  470.  
  471. If you add compiled fonts to your system as described in the fonts.doc
  472. file, you must C-compile them in an environment that includes some
  473. definitions from vms-cc.mak.  Find the section of vms-cc.mak with the
  474. comment "Give ourself a healthy search list for C include files" and
  475. execute the immediately following DEFINE commands before C-compiling the
  476. fonts.
  477.  
  478. ********
  479. ******** A guide to the files ********
  480. ********
  481.  
  482. General
  483. -------
  484.  
  485. There are very few machine dependencies in Ghostscript.  A few of the .c
  486. files are machine-specific.  These have names of the form
  487.     gp_<platform>.c
  488. specifically
  489.     gp_dosfb.c (all MS-DOS platforms)
  490.     gp_msdos.c (all MS-DOS platforms)
  491.     gp_itbc.c (MS-DOS, Borland compilers)
  492.     gp_iwatc.c (MS-DOS, Watcom compiler)
  493.     gp_unix.c (all Unix)
  494.     gp_sysv.c (System V Unix)
  495.     gp_vms.c (VMS)
  496. There are also some machine-specific conditionals in files with names
  497. <something>_.h.  If you are going to extend Ghostscript to new
  498. machines or operating systems, you should check the *_.h files for
  499. ifdef's on things other than DEBUG, and you should probably count on
  500. making a new makefile and a new gp_ file.
  501.  
  502. Library
  503. -------
  504.  
  505. Files beginning with gs, gx, or gz (both .c and .h), other than gs.c
  506. and gsmain.c, are the Ghostscript library.  Files beginning with gdev
  507. are device drivers or related code, also part of the library.  Other
  508. files beginning with g are library files that don't fall neatly into
  509. either the kernel or the driver category.
  510.  
  511. Interpreter
  512. -----------
  513.  
  514. gs.c is the main program for the language interpreter.
  515.  
  516. Files beginning with z are Ghostscript operator files.  The names of the
  517. files generally follow the section headings of the operator summary in
  518. section 6.2 of the PostScript manual.
  519.  
  520. .c files beginning with i, and .h files not beginning with g, are the
  521. rest of the interpreter.  See the makefile for a little more information
  522. on how the files are divided functionally.
  523.  
  524. There are a few files that are logically part of the interpreter, but that
  525. are potentially useful outside Ghostscript, whose names don't begin with
  526. either g, z, or i:
  527.  
  528.     s*.c (a flexible stream package, including the Level 2 PostScript
  529. 'filters' supported by Ghostscript);
  530.